/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package BL;

import javax.swing.JOptionPane;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import org.edisoncor.gui.textField.TextField;

/**
 *
 * @author Guillermo
 */
public class LimitarCaracteres {

    private TextField editor;
    private int num;

    public LimitarCaracteres(TextField editor, int num) {
        this.editor = editor;
        this.num = num;
    }

    public void insertString(int arg0, String arg1, AttributeSet arg2) throws BadLocationException {
        if ((editor.getText().length() + arg1.length()) > this.num) {
            JOptionPane.showMessageDialog(null, "Limite de caracteres", "Informacion", JOptionPane.INFORMATION_MESSAGE);
        }
//        super.insertString(arg0, arg1, arg2);
    }

}
